revealer: Don't report >0 preferred width...
authorTimm Bäder <mail@baedert.org>
Fri, 19 Feb 2016 12:22:02 +0000 (13:22 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 24 Feb 2016 01:45:45 +0000 (20:45 -0500)
... if the child is concealed and the transition type is set to NONE.
In this case, both preferred width and preferred height should be 0, but
we still can't use that to allocate a size for the child, so care about
the minimum size of the child in gtk_revealer_get_child_allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=761760

gtk/gtkrevealer.c

index e4d144b56df792f8e8f61cd3d1410cb1ff29c3d6..52ebd26b87b1ec3131134c3b407c7d0e3aa24e42 100644 (file)
@@ -339,6 +339,13 @@ gtk_revealer_get_child_allocation (GtkRevealer   *revealer,
           transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
         gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding), NULL,
                                                    &child_allocation->width);
+      else if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE)
+        {
+          gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding), NULL,
+                                                     &child_allocation->width);
+          gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding), NULL,
+                                                     &child_allocation->height);
+        }
       else
         gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding), NULL,
                                                    &child_allocation->height);
@@ -873,7 +880,8 @@ set_width_with_paddings (GtkRevealer *revealer,
   natural_width = preferred_natural_width + horizontal_padding;
 
   transition = effective_transition (revealer);
-  if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
+  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
+      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
       transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
     {
       /* Paddings are included in the animation */